home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / bcrt.zip / BIOSTEST.PAS < prev   
Pascal/Delphi Source File  |  1988-08-29  |  3KB  |  93 lines

  1. { A quicky test program to show how it works }
  2. { Originally Written by Michael Day 23 August 1988 }
  3. { released to the public domain 23 August 1988 }
  4. { This version 2.0 as of 29 August 1988 }
  5. { (also released to the public domain) }
  6. program BiosTest;
  7. uses Graph,BiosCrt;
  8. var c,i, GrDriver, GrMode:integer;
  9.     mx, my, ChSize, ChRow, GxMode : integer;
  10.     BW:Text;
  11. begin
  12.   BiosTextColor(White);
  13.   BiosTextBackground(black);
  14.   BiosWriteMode := 0;
  15.   BiosGotoXY(0,0);
  16.   writeln('Burp!');   {this should disappear from the screen}
  17.   BiosClrScr;
  18.  
  19.   assignbiostext(BW);
  20.   ReWrite(BW);
  21.   BiosGotoXY(0,1);
  22.   writeln(BW,'Attr:',biostextattr);
  23.  
  24.   ChSize := BiosCHarSize;          {get some character infor from Bios}
  25.   if ChSize = 0 then ChSize := 8;  {CGA is normally 0 so force it}
  26.   ChRow := succ(BiosMaxY);
  27.   if ChRow = 1 then ChRow := 25;
  28.  
  29.   GrDriver := Detect;        {detect what kind of display is out there}
  30.   GrMode := 0;
  31. {  Grdriver := CGA; }         {for you EGA/VGA guys, you can force CGA}
  32. {  Grmode := CGAC0; }              {here to see what it will look like}
  33.  
  34.   InitGraph(Grdriver,grmode,'');
  35.   If GraphResult <> GrOK then
  36.   begin
  37.     WriteLn('Ouch! something went wrong!');
  38.     Halt(1);
  39.   end;
  40.  
  41.   SetViewPort(0,15,GetMaxX,GetMaxY,true);
  42.  
  43.   writeln(BW,'Burp!');   {this should disappear from the screen}
  44.   BiosTextColor(0);      {note: in graph mode we have to turn both the}
  45.   BiosTextBackGround(0); {foreground and background off to clear the screen}
  46.   BiosClrScr;            {remember to do the same for insert and delete line}
  47.   BiosTextColor(white);
  48.  
  49.   {note that we use Pixel math the center the message here}
  50.   BiosPixGoto((GetMaxX div 2) - 18*TextWidth('X'),0);
  51.   Write(BW,'BiosPixGoto() = Pixel X,Y -> Char X,Y');
  52.  
  53. {put some graphics on the screen just to prove we really are in graphics mode}
  54.   SetColor(white);
  55.   mx := GetMaxX div 4;    {calculate relative screen information}
  56.   my := GetMaxY div 4;
  57.   rectangle(mx,my,mx*3,my*3);
  58.   i := 10;
  59.   while i < mx*2 do
  60.   begin
  61.     circle(mx*2,my*2,i);
  62.     inc(i,10);
  63.   end;
  64.  
  65.                                  {now show the three write modes}
  66.   SetBiosWriteMode(0);
  67.   BiosTextColor(1);
  68.   BiosGotoXY((BiosMaxX div 2) - 13,ChRow div 8);
  69.   Write(BW,' Bios Background Overwrite ');                  {as TFDD}
  70.   BiosGotoXY((BiosMaxX div 2) - 11,Succ(ChRow div 8));
  71.   BiosWrite(' - BiosWriteMode(0) - ');                    {or regular}
  72.  
  73.  
  74.   SetBiosWriteMode(1);
  75.   BiosTextColor(2);
  76.   BiosGotoXY((BiosMaxX div 2) - 15,pred(ChRow div 2));
  77.   Write(BW,'Bios Xor Foreground Only Write');
  78.   BiosGotoXY((BiosMaxX div 2) - 11,ChRow div 2);
  79.   BiosWrite(' - BiosWriteMode(1) - ');
  80.  
  81.  
  82.   SetBiosWriteMode(2);
  83.   BiosTextColor(0);
  84.   BiosTextBackground(3);
  85.   BiosGotoXY((BiosMaxX div 2) - 18,(ChRow div 8)*7);
  86.   Write(BW,' Bios Temp New Background Overwrite ');
  87.   BiosGotoXY((BiosMaxX div 2) - 11,Succ((ChRow div 8)*7));
  88.   BiosWriteLn(' - BiosWriteMode(2) - ');
  89.  
  90.   ReadLn;        {Wait for them to look at the screen}
  91.   CloseGraph;    {Go Home!}
  92. end.
  93.